<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
       <%@ taglib prefix="s" uri="/struts-tags" %>
       <%@ taglib prefix="sx" uri="/struts-dojo-tags" %>
           <%@ page import="net.tanesha.recaptcha.ReCaptcha" %>
    <%@ page import="net.tanesha.recaptcha.ReCaptchaFactory" %>
       
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<sx:head/>
<script language = "Javascript">
     
<%@ page import="com.action.Home;" %>
   

function validateCountry(countryname)
{
		var xyz=countryname.value;
		if(xyz==0)
			{
			alert("Select a Country");
			return false;
			}
		else
			return true;
		}

function validateSecretquestion(secretques)
{
	   
	   var xyz=secretques.value;
		if(xyz==0)
			{
			alert("Select some secret question");
			return false;
			}
		else
			return true;
		}

	   


function emailcheck(str) {

var at="@"
var dot="."
var lat=str.indexOf(at)
var lstr=str.length
var ldot=str.indexOf(dot)
if (str.indexOf(at)==-1){
alert("Invalid E-mail ID")
return false;
}

if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
alert("Invalid E-mail ID")
return false;
}

if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
alert("Invalid E-mail ID")
return false;
}

if (str.indexOf(at,(lat+1))!=-1){
alert("Invalid E-mail ID")
return false;
}

if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
alert("Invalid E-mail ID")
return false;
}

if (str.indexOf(dot,(lat+2))==-1){
alert("Invalid E-mail ID")
return false;
}

if (str.indexOf(" ")!=-1){
alert("Invalid E-mail ID")
return false;
}

return true ;
}

 
function ValidateForm()
{
var firstname=document.register.firstname;
var lastname=document.register.lastname;
var homeaddress=document.register.homeaddress;
var city=document.register.city;
var state=document.register.state;
var pincode=document.register.pincode;
var countryname=document.register.countryname;
var phoneno=document.register.phoneno;
var email=document.register.email;
var ebayuserid=document.register.ebayuserid;
var password=document.register.password;
var secretques=document.register.secretques;
var answer=document.register.answer;
var dob=document.register.dob;

if (firstname.value==null || name.value=="")
{
alert("First Name is Missing");
return false;
}
if (lastname.value==null || lastname.value=="")
{
alert("Last Name is Missing");
return false;
}
if (homeaddress.value==null || homeaddress.value=="")
{
alert("Home Address is Missing");
return false;
}
if (city.value==null || city.value=="")
{
alert("City is Missing");
return false;
}
if (state.value==null || state.value=="")
{
alert("State is Missing");
return false;
}
if (pincode.value==null || pincode.value=="")
{
alert("Pincode is Missing");
return false;
}
if(validateCountry(countryname)==false)
{
alert("Please select a item.");
document.interest.focus();
}
if (phoneno.value==null || phoneno.value=="")
{
alert("Phone Number is Missing");
return false;
}
if (email.value==null || email.value=="")
{
email.select();
alert("Pincode is Missing");
return false;
}
if (emailcheck(email.value)==false)
{
	email.value="";
	email.focus();
	return false;
}
if (ebayuserid.value==null || ebayuserid.value=="")
{
alert("eBay user id is Missing");
return false;
}
if (password.value==null || password.value=="")
{
alert("password is Missing");
return false;
}
if (confirmpassword.value==null || password.value=="")
{
alert("Reenter password!!!! Confirm password field missing");
return false;
}
if(validateSecretquestion(secretques)==false)
{
alert("Please select a item.");
document.interest.focus();
}

if (answer.value==null || answer.value=="")
{
alert("Answer field is Missing");
return false;
}
if ((dob.value==null)||(dob.value=="")){
 dob.focus();
 alert("Date of Birth is necessary ");  
return false;
}
}



</script>
 





<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Register</title>
<link rel="stylesheet" type="text/css" href="style.css" />
<link rel="stylesheet" type="text/css" href="iecss.css" />
<script type="text/javascript" src="js/boxOver.js"></script>

</head>
<body>
<div id="main_container">

	<div id="header">

      <div class="top_right">
       
           
            <div class="big_banner">
           
            </div>
        
      </div>
    
  
        <div id="logo"><a href="index.html"><img src="logoEbay_x45.gif" alt="" title="" border="0" width="130" height="31" /></a></div>
        

        

    </div>
<s:form  name="register"  method="post" action="register" enctype="multipart/form-data" onSubmit="return ValidateForm()"> 

 
  <div id="center_title_bar">REGISTER AS AN eBay MEMBER </div></br></br></br></br>
<fieldset>
    
    <legend ><b>Tell about yourself - all fields are required</b></legend>
    First Name  : <s:textfield name="firstname" theme="simple"/>
  	Last Name: <s:textfield name="lastname" theme="simple"/><br></br>
  	Home Address:  <s:textarea name="homeaddress" theme="simple"/><br></br>
  	City: <s:textfield name="city" theme="simple"/><br></br>
  	State: <s:textfield name="state" theme="simple"/>
  	Pin Code: <s:textfield name="pincode" theme="simple"/>
  	Country:<s:select theme="simple" name="countryname" list="countryname"></s:select></br></br>
  	Telephone No: <s:textfield name="phoneno" theme="simple"/><br></br>	
  	e-mail: <s:textfield name="email" theme="simple"/><br></br>
  	
</fieldset>

<fieldset>
    <legend><b>Create your Id and Password - all fields are required</b></legend>
    
    eBay User Id  : <s:textfield name="ebayuserid" theme="simple"/></br></br>
    Password  : <s:password name="password" theme="simple"/></br></br>
    Confirm Password  : <s:password name="confirmpassword" theme="simple"/>
    Secret Question:<s:select theme="simple" name="secretques" list="secretques"></s:select></br></br>
   	Answer : <s:textfield name="answer" theme="simple"/></br></br> 	
   	DOB : <sx:datetimepicker name="dob" displayFormat="dd-MM-yyyy" formatLength="long" requiredposition="left"></sx:datetimepicker>
    
    	<%
          ReCaptcha c = ReCaptchaFactory.newReCaptcha("6LcJIs8SAAAAAA1Rfv4gKjIG5tiapqcU9vPjhHrQ", "6LcJIs8SAAAAADUp1meZJnbEdoYpLzB0BQrv9Ex9", false);
          out.print(c.createRecaptchaHtml(null, null));
        %>
    <s:submit name="submit" value="submit" theme="simple"/>
    </fieldset>
    
   
    </s:form>


</div>
</body>
</html>